﻿Imports System.Data.OleDb
Public Class frmConfig

    Private Sub btSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSalir.Click
        Me.Close()
    End Sub

    Private Sub frmConfig_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim infoConfig As New C_config
        Dim drConfig As OleDbDataReader

        Dim id_config As Integer
        Dim Encabezado As String = ""
        Dim Firma As String = ""
        Dim Email As String = ""
        Dim Password As String = ""
        Dim Smtp As String = ""
        Dim Port As String = ""

        drConfig = infoConfig.GetConfig
        While drConfig.Read
            If Not drConfig.IsDBNull(0) Then
                id_config = drConfig.GetInt32(0)
            End If
            If Not drConfig.IsDBNull(1) Then
                Encabezado = drConfig.GetString(1)
            End If
            If Not drConfig.IsDBNull(2) Then
                Firma = drConfig.GetString(2)
            End If
            If Not drConfig.IsDBNull(3) Then
                Email = drConfig.GetString(3)
            End If
            If Not drConfig.IsDBNull(4) Then
                Password = drConfig.GetString(4)
            End If
            If Not drConfig.IsDBNull(5) Then
                Smtp = drConfig.GetString(5)
            End If
            If Not drConfig.IsDBNull(6) Then
                Port = drConfig.GetString(6)
            End If
        End While
        drConfig.Close()
        cadenaConexBD.Close()

        lblIdConfig.Text = id_config
        rtEncabezado.Text = Encabezado
        rtFirma.Text = Firma
        txtEmailUser.Text = Email
        txtPassEmail.Text = Password
        txtSmtp.Text = Smtp
        txtPort.Text = Port

    End Sub

    Private Sub btguardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btguardar.Click
        Dim ActualizarConfiguracion As New C_config
        ActualizarConfiguracion.updateConfig()
        Me.Close()
    End Sub
End Class